<div ng-controller="OperationDataTableController">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3"><span class="font-bold">{{title}}</span>
        </h1>
    </div>
    <div ng-class="isSmart?'':'wrapper-md'" class="remove-wrapper" >
        <div class="panel panel-default">
            <div>
                <div class="row wrapper-sm">
                    <div class="col-xs-12">
                        <div class="input-group">
                            <input ng-model="searchKey" class="form-control pull-right"
                                   placeholder="{{ (selectLang == 'English') ? 'enter keywords' : '\u8bf7\u8f93\u5165\u5173\u952e\u5b57' }}"
                                   type="text" autocomplete="off">
                            <span class="input-group-btn">
                                <button class="btn btn-success font-bold" type="button" ng-click="startSearch()"><span
                                        translate="business.navtitle.search_patient">Search</span></button>
                            </span>
                        </div>
                    </div>
                </div>
                <table ui-jq="dataTable" style="width:100%" ui-options="dtOptions" class="table table-striped m-b-none">
                    <thead>
                    <tr>
                        <th ng-class="isSmart?'col-xs-4':''" translate="business.servreq.id"></th>
                        <th ng-class="isSmart?'col-xs-4':''" translate="common.name"></th>
                        <th translate="user.gender" ng-if="!isSmart"></th>
                        <th translate="business.patcase.disease_type" ng-if="!isSmart"></th>
                        <th translate="business.accumulation.dateOpe" ng-if="!isSmart"></th>
                        <th ng-class="isSmart?'col-xs-4':''" translate="common.operate"></th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="serv in servRequests">
                        <td>S-{{ serv.servReq_Id }}</td>
                        <td>{{ serv._patCase._patient._user.realName }}</td>
                        <td ng-if="!isSmart">
                            <span ng-show="serv._patCase._patient._user.gender != null"
                                  translate="{{ 'user.gender.' + serv._patCase._patient._user.gender }}"></span>
                        </td>
                        <td ng-if="!isSmart">
                            <span translate="{{'business.patcase.disease_type_' + serv._diseaseType.desc }}"></span>
                        </td>
                        <td ng-if="!isSmart">{{ moment(serv._opeCenTime.date_Operation).format('YYYY-MM-DD') }}</td>
                        <td style="width:100px;">
                            <button type="button"
                                    ng-click="open({ templateUrl: 'openServReq.html'}, {{ serv }} );"
                                    class="btn btn-sm btn-info font-bold"
                                    title="{{ 'common.details' | translate }}">
                                <span translate="common.details"></span>
                            </button>
                            <button type="button" ng-click="openConfirmPopup(serv)"
                                    class="btn btn-sm btn-success font-bold"
                                    title="{{'common.confirm' | translate }}" ng-show="serv.isCanConfirm == true">
                                <span translate="common.confirm"></span>
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <script type="text/ng-template" id="openServReq.html">
        <div ng-include="'views/work/basic_servreq_flow.html?abc=d'"></div>
    </script>
</div>
<script type="text/ng-template" id="TakeDescription.html">
    <div class="modal-header">
        <button type="button" class="close" ng-click="cancel()"><span class="icon icon-close" aria-hidden="true"></span>
        </button>
        <h4>{{ 'common.confirmalert'|translate}}</h4>
    </div>
    <div class="modal-body">
        <div class="wrapper-xs">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-group">
                        <div class="form-group row">
                            <label class="col-sm-2 control-label ">{{ 'user.icNo' | translate }}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       value="{{items._patCase._patient._user.icNo}}" style="cursor:default" disabled>
                            </div>
                            <label class="col-sm-2">{{ 'user.realname' | translate }}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       ng-model="items._patCase._patient._user.realName" style="cursor:default"
                                       disabled>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-2 control-label ">{{ 'user.gender' | translate }}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       value="{{'user.gender.' + items._patCase._patient._user.gender | translate}}"
                                       style="cursor:default" disabled>
                            </div>
                            <label class="col-sm-2">{{'business.patcase.disease_type' | translate}}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       value="{{'business.patcase.disease_type_' + items._diseaseType.desc | translate}}"
                                       style="cursor:default" disabled>
                            </div>
                            <div class="clearfix"></div>
                        </div>

                        <div class="form-group row" ng-if="items.isShowAmountOperation == true">
                            <label class="col-sm-2">{{'business.servreq.amount_Operation' | translate}}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       ng-model="items.amount_Operation" style="cursor:default">
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="wrapper-xs" ng-show="items.isShowDesc == true && items.canConfirmFromDate">
            <h4>{{'business.patcase.description' | translate}}</h4>
            <textarea class="form-control" style="resize: none;" rows="3" ng-model="items.desc">
            </textarea>
        </div>
        <div class="wrapper-xs" ng-show="!items.canConfirmFromDate">
            <font color="red"><h4>{{'business.servreq.confirm_NotAllow' | translate}}</h4></font>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-default" ng-click="cancel()">{{ 'common.cancel' | translate }}</button>
        <button class="btn btn-primary" ng-click="ok()" ng-if="items.canConfirmFromDate">{{ 'common.ok' | translate }}
        </button>
    </div>
</script>